//
//  ResourcesManager.m
//  jumpingfrog
//
//  Created by Tri Vo on 8/16/13.
//  Copyright (c) 2013 Tri Vo. All rights reserved.
//

#import "ResourcesManager.h"
#import "GeneralDef.h"


@implementation ResourcesManager
static ResourcesManager *instance = NULL;

+ (id) getInstance {
    if (instance == NULL) {
        instance = [[ResourcesManager alloc] init];
    }
    return instance;
}

- (id)init {
    if (self = [super init]) {
        [self loadAllResources];
    }
    return self;
}

- (void)dealloc {
    if (m_spriteSheetFrog != nil) {
        [m_spriteSheetFrog release];
    }
    [super dealloc];
}

+ (void) destroyInstance {
    [instance release];
    instance = NULL;
}

#pragma mark - Class Methods

- (void) loadAllResources {
    CCSpriteFrameCache *defaultFrameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
    [defaultFrameCache addSpriteFramesWithFile:SPRITE_PLIST];
    
//    m_spriteSheetFrog = [[CCSpriteBatchNode alloc] initWithFile:SPRITE_PNG capacity:29];
}

- (CCSpriteFrameCache *) getSharedFrameCache {
    return [CCSpriteFrameCache sharedSpriteFrameCache];
}

- (CCSpriteBatchNode *)getSpriteSheetForFrog {
    return m_spriteSheetFrog;
}


@end
